#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<string.h>
#include<fcntl.h>
#include<unistd.h>

#define LOG "log.txt"//日志文件
#define SIZE 32

int main()
{
    int fd=open(LOG,O_WRONLY |O_CREAT | O_TRUNC,0666);
    if(fd == -1)
    {
        perror("open file fail\n");
        exit(-1);
    }
    const char* ps="Hello System Call!\n";
    int cnt=5;
    while(cnt--)
    {
        write(fd,ps,strlen(ps));//不能将'\0'写入文件
    }
    close(fd);

    return 0;

}

